package cn.acheng1314.springboot2.controller


import cn.acheng1314.exceptions.ForbiddenException
import cn.acheng1314.exceptions.NotFoundException
import cn.acheng1314.exceptions.UnauthorizedException
import cn.acheng1314.springboot2.dto.HousePropertyDTO
import cn.acheng1314.springboot2.model.ResponseWrap
import cn.acheng1314.springboot2.service.IHousePropertyService
import io.swagger.annotations.Api
import io.swagger.annotations.ApiOperation
import org.slf4j.LoggerFactory
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.http.MediaType
import org.springframework.stereotype.Controller
import org.springframework.web.bind.annotation.*

@Controller
@Api(description = "外层信息，无需Shiro接管，集成文件下载控制器")
class MainController {

    private val log = LoggerFactory.getLogger(this::class.java)

    @GetMapping(path = ["/getEx"], produces = [(MediaType.APPLICATION_JSON_VALUE)])
    @ApiOperation(value = "异常调试")
    fun getEx(@RequestParam(value = "type", required = false) type: Int?) {
        when (type) {
            null -> throw NotFoundException("未找到！")
            1 -> throw UnauthorizedException("验证未通过！")
            2 -> throw ForbiddenException("禁止使用！")
            else -> throw Exception("other Exception！")
        }
    }

}
